import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart' hide Action, Page;

import 'action.dart';
import 'state.dart';

Widget buildView(PageState state, Dispatch dispatch, ViewService viewService) {
  final ListAdapter adapter = viewService.buildAdapter()!;
  return Scaffold(
    appBar: AppBar(
      backgroundColor: state.themeColor,
      title: const Text('ToDoList'),
    ),
    body: ListView.builder(
        itemBuilder: adapter.itemBuilder as IndexedWidgetBuilder,
        itemCount: adapter.itemCount),
    //Container(
    //   child: Column(
    //     children: <Widget>[
    //       viewService.buildComponent('report'),
    //       Expanded(
    //           child: )
    //     ],
    //   ),
    // ),
    floatingActionButton: FloatingActionButton(
      onPressed: () => dispatch(PageActionCreator.onAddAction()),
      tooltip: 'Add',
      child: const Icon(Icons.add),
    ),
  );
}
